
import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2023/3/29 13:55
 * 洗牌
 * MP3光标位置
 */
public class Day21 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        scanner.nextLine();
        String command = scanner.nextLine();
            int[] arr = solution2(command,num);
            if (num>=4){
                for (int i = 0; i < 4; i++) {
                    if (i!= 3){
                        System.out.print(arr[i] + " ");
                    }else {
                        System.out.println(arr[i]);
                    }
                }
                System.out.println(arr[4]);
            }else{
                for (int i = 0; i < num; i++) {
                    if (i!= num-1){
                        System.out.print(arr[i] + " ");
                    }else {
                        System.out.println(arr[i]);
                    }
                }
                System.out.println(arr[4]);
            }


    }
    public static int[] solution2(String command, int num){
        int[] target = new int[num];
        for (int i = 0; i < num; i++) {
            target[i] = i+1;
        }
        int left = 0;
        int right = left+3;
        int cur = 0;


        for (int i = 0; i < command.length(); i++) {

            if (command.charAt(i) == 'U' ){
                if (num <= 4){
                    cur = (cur-1 + num)%num;
                }else {
                    if (cur == left){
                        left = (left-1 + num)%num;
                        right = (right-1 + num)%num;
                    }
                    cur = (cur-1 + num)%num;
                    if(cur == num-1){
                        left = num-4;
                        right = num-1;
                    }
                }
            }else {
                if (num <= 4){
                    cur = (cur+1 + num)%num;
                }else {

                    if (cur == right){
                        left = (left+1 + num)%num;
                        right = (right+1 + num)%num;
                    }
                    cur = (cur+1 + num)%num;
                    if (cur==0){
                        left = 0;
                        right = left+3;
                    }
                }
            }
        }
        int[] window = new int[5];

        if (num>=4){
            for (int i = 0; i < 4; i++) {
                window[i] = target[left];
                left = (left+1 + num)%num;;
            }
            window[4] = target[cur];
        }else{
            for (int i = 0; i < num; i++) {
                window[i] = target[left];
                left = (left+1 + num)%num;
            }
            window[4] = target[cur];
        }

        return window;
    }
    //-----------------------------------------
    public static void main1(String[] args) {
        Scanner s = new Scanner(System.in);
        int count= s.nextInt();
        while (count>0){
            count--;
            int n = s.nextInt();
            int k =s.nextInt();
            int[] poker1 = new int[n];
            int[] poker2 = new int[n];
            for (int i = 0; i < n; i++) {
                poker1[i] = s.nextInt();
            }
            for (int i = 0; i < n; i++) {
                poker2[i] = s.nextInt();
            }
            solution1(poker1,poker2,k);

            for (int i = 0; i < n; i++) {
                System.out.print(poker1[i] + " ");
            }
            for (int i = 0; i < n; i++) {
                if (i!= n-1){
                    System.out.print(poker2[i] + " ");
                }else{
                    System.out.println(poker2[i]);
                }
            }
        }
    }
    public static void solution1 (int[] poker1,int[] poker2,int k){
        Deque<Integer> stack = new LinkedList<>();
        while (k>0){
            k--;
            for (int i = poker1.length-1; i >= 0 ; i--) {
                stack.push(poker2[i]);
                stack.push(poker1[i]);
            }
            for (int i = 0; i < poker1.length; i++) {
                poker1[i] = stack.pop();
            }
            for (int i = 0; i < poker1.length; i++) {
                poker2[i] = stack.pop();

            }
        }

    }
}
